package com.dc.entity.special;

import com.dc.entity.ShipRepairEntity;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.fasterxml.jackson.annotation.JsonIgnore;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;

import javax.persistence.*;
import java.util.Date;


/**
 *  6-0-涂装喷漆-舱室及船壳喷漆
 */
@Data
@AllArgsConstructor
@NoArgsConstructor
@Entity
@Table(name = "t_workflow_special_1_paint_ship")
public class WorkflowSpecial1PaintShipEntity {

    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    private Long id;

    @Column(name = "ship_repair_id", columnDefinition = "bigint unsigned NOT NULL", insertable = false, updatable = false)
    private Long shipRepairId;      // 维修记录 外键id

    @Column(name = "submit_time")
    @JsonFormat(pattern = "yyyy-MM-dd")
    private Date submitTime;        // 填写日期

    @Column(name = "ship_name", length = 50)
    private String shipName;        // 船体名称

    @Column(name = "reporter", length = 20)
    private String reporter;        // 填报人

    ////////////////////////////////////////////
    @Column(name = "place", length = 50)
    private String place;           // 施工位置

    @JsonFormat(pattern = "yyyy-MM-dd")
    @Temporal(TemporalType.TIMESTAMP)
    @Column(name = "start_time")
    private Date startTime;         // 开始日期

    @JsonFormat(pattern = "yyyy-MM-dd")
    @Temporal(TemporalType.TIMESTAMP)
    @Column(name = "end_time")
    private Date endTime;           // 结束日期

    @Column(name = "area")
    public Double area;            // 施工面积(m²)

    @Column(name = "num")
    public Integer num;            // 喷漆次数(度)

    @Column(name = "total_area")
    public Double totalArea;       // 舱室及船壳喷漆面积（m2） 动态计算 area*num

//    @Transient
//    public Double gasByUnit;       // 单位耗天然气量标定值
//
//    @Transient
//    public Double gas;             // 天然气

    @Column(name = "air_by_unit")
    public Double airByUnit;       // 单位耗压缩空气量标定值

    @Column(name = "air")
    public Double air;             // 压缩空气量

    ////////////////////////////////////////////

    @JsonIgnore
    @ManyToOne(fetch = FetchType.LAZY)
    @JoinColumn(name = "ship_repair_id")
    private ShipRepairEntity shipRepairEntity;

}
